﻿using System.Collections.Generic;
using Aragorn.SOA.ORM.DapperExtensions;

namespace Aragorn.SOA.ORM
{
    public class MultiInsertCommand<T>
    where T : class
    {
        private IEnumerable<T> models;

        private DbContextData Data
        {
            get;
            set;
        }

        public MultiInsertCommand(DbContextData contextData, IEnumerable<T> entities)
        {
            this.Data = contextData;
            this.models = entities;
        }

        public void Execute()
        {
            this.Data.Connection.Insert<T>(this.models, this.Data, this.Data.Transaction, this.Data.CommandTimeout);
        }
    }
}